<template>
   <div class="list-item">
        <div class="home-tab">
                <a href="javascript:void(0);" v-for="(item,index) in title" :class='{active:index==currentIndex}' @click="tabIndex(index)">
                    {{item}}
                </a>   
        </div>
        <ul class="futer-item" >
             <li class="item-datil" v-for="(item,index) in listImg" :key="item.id">
                 <img :src="item.imgaddr[0]" alt="">
                 <!-- <img src="../images/nav06.png" alt=""> -->
             </li>
        </ul>
    </div>
</template>
<script>
export default {
    name:'homeTab',
    props:{
        'title':{
            type:Array,
            default(){
                return []
            }
        },
        'listImg':{
            type:Object,
            default(){
                return {} 
            }
        }
    },
    data(){
        return{
            currentIndex:0,
        }
    },
    methods:{
      tabIndex(index){
          this.currentIndex=index;
      }
    }
    
}
</script>
<style scoped>
.home-tab{
   position: -webkit-sticky;
    position: sticky;
    top:100px;
    margin:10px 0;
    display:flex;
    height: 44px;
    line-height:44px;
    width: 100%;
    text-align:center;
   
    background: rgb(16, 143, 216);
}
.home-tab a{
    color:#fff;
     font-size: 18px;
    flex:1;
}
.home-tab .active{
    background:pink;
}
.futer-item{
    width: 100%;
    display:flex;
}
.futer-item .item-datil{
    flex:1;
}
.futer-item .item-datil img{
    width: 100px;
    height: 100px;
}
</style>